﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.world.machines {
    import flash.events.*;
    import reprise.commands.*;
    import flash.display.*;
    import reprise.data.*;
    import flash.filters.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.views.world.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class AbstractMachineView extends AbstractActorView implements IMachineView {

        private var _cleaningAnimation:MovieClip;
        private var _cleaningMovieClipController:MovieClipController;

        public function AbstractMachineView(_arg1:String, _arg2:MovieClip){
            _asset = _arg2;
            super(_arg1, 0, 0, null);
            if (_asset.mouse_over_frame){
                _asset.mouse_over_frame.visible = false;
            };
            this.createCleaningAnimation();
        }
        override public function getBitmapFilter():BitmapFilter{
            return (Filters.getFilter(Filters.MACHINE_GLOW));
        }
        public function isBackground():Boolean{
            return (false);
        }
        public function playCleaningAnimation():void{
            addChild(this._cleaningAnimation);
            this._cleaningMovieClipController.execute();
        }
        private function cleaningMovieClipController_complete(_arg1:Event):void{
            removeChild(this._cleaningAnimation);
            this._cleaningMovieClipController.gotoAndStop(1);
        }
        private function createCleaningAnimation():void{
            this._cleaningAnimation = AssetsLibrary.getMovieClip(GameConstants.CLEANING_ANIMATION);
            this._cleaningAnimation.mouseEnabled = false;
            this._cleaningAnimation.scaleX = (this._cleaningAnimation.scaleY = 1);
            this._cleaningAnimation.x = 140;
            this._cleaningAnimation.y = -100;
            this._cleaningMovieClipController = new MovieClipController(this._cleaningAnimation);
            this._cleaningMovieClipController.gotoAndStop(1);
            this._cleaningMovieClipController.setFrameRange(new Range(1, 30));
            this._cleaningMovieClipController.addEventListener(Event.COMPLETE, this.cleaningMovieClipController_complete);
        }

    }
}//package net.wooga.pets.views.world.machines 
